//package com.yyfax.pay.config.controller.api;
//
//import java.util.List;
//
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.yyfax.commons.lang.BeanUtil;
//import com.yyfax.commons.lang.DateUtil;
//import com.yyfax.framework.model.EmptyContent;
//import com.yyfax.framework.model.YYFaxRsp;
//import com.yyfax.framework.yyfax.enums.RspCodeEnum;
//import com.yyfax.pay.common.model.to.YYPayReq;
//import com.yyfax.pay.config.data.service.PaymentQuotaService;
//import com.yyfax.pay.config.model.po.PaymentQuotaPO;
//import com.yyfax.pay.config.model.to.PaymentQuotaQueryContent;
//import com.yyfax.pay.config.model.to.PaymentQuotaQueryParams;
//import com.yyfax.pay.config.model.to.PaymentQuotaSaveContent;
//import com.yyfax.pay.config.model.to.PaymentQuotaSaveParams;
//
///**
// * 商户支付限额信息
// * 
// * @author changxd
// * @date 2017-04-13
// * @since 1.0.0
// */
//@RestController
//public class PaymentQuotaApiController {
//
//	@Autowired
//	private PaymentQuotaService paymentQuotaService;
//
//	/**
//	 * 新增商户支付限额信息
//	 * 
//	 * @author changxd
//	 * @date 2017-04-13
//	 * @since 1.0.0
//	 * @param req
//	 * @return
//	 * @throws Exception
//	 */
//	@RequestMapping(path = "/payment_quota/save")
//	public YYFaxRsp<PaymentQuotaSaveContent> save(@RequestBody YYPayReq<PaymentQuotaSaveParams> req) throws Exception {
//		PaymentQuotaSaveParams params = req.getParams();
//
//		// 数据校验
//		params.validate();
//
//		// 获取创建时间
//		params.setCreateTime(DateUtil.getCurrentDateTime());
//
//		PaymentQuotaPO po = new PaymentQuotaPO();
//		BeanUtil.copyProperties(params, po);
//		
//		
//		int id = paymentQuotaService.save(po);
//		
//		PaymentQuotaSaveContent content = new PaymentQuotaSaveContent();
//		content.setId(id);
//		return new YYFaxRsp<PaymentQuotaSaveContent>(RspCodeEnum.SUCCESS, "新增商户支付限额信息成功", content);
//	}
//
//	/**
//	 * 修改商户支付限额信息
//	 * 
//	 * @author changxd
//	 * @date 2017-04-13
//	 * @since 1.0.0
//	 * @param req
//	 * @return
//	 * @throws Exception
//	 */
//	@RequestMapping(path = "/payment_quota/modify")
//	public YYFaxRsp<EmptyContent> modify(@RequestBody YYPayReq<PaymentQuotaSaveParams> req) throws Exception {
//		PaymentQuotaSaveParams params = req.getParams();
//		// 数据校验
//		params.validate();
//
//		PaymentQuotaPO po = new PaymentQuotaPO();
//		BeanUtil.copyProperties(params, po);
//		paymentQuotaService.modify(po);
//
//		return new YYFaxRsp<EmptyContent>(RspCodeEnum.SUCCESS, "更新商户支付限额信息成功");
//	}
//
//	/**
//	 * 查询商户支付限额信息
//	 * 
//	 * @author changxd
//	 * @date 2017-04-13
//	 * @since 1.0.0
//	 * @param req
//	 * @return
//	 * @throws Exception
//	 */
//	@RequestMapping(path = "/payment_quota/list")
//	public YYFaxRsp<PaymentQuotaQueryContent> queryForList(@RequestBody YYPayReq<PaymentQuotaQueryParams> req) throws Exception {
//		PaymentQuotaQueryParams params = req.getParams();
//		PaymentQuotaQueryContent content = new PaymentQuotaQueryContent();
//
//		if (params != null) {
//			if (params.getid() > 0) {
//				PaymentQuotaPO po = paymentQuotaService.queryById(params.getid());// 根据id查询
//				content.setPaymentQuota(po);
//			} else if (StringUtils.isNotBlank(params.getMerchantCode()) && StringUtils.isNotBlank(params.getPaymentCode())) {
//				// 根据商户编号和支付渠道号查询
//				List<PaymentQuotaPO> list = paymentQuotaService.queryByMerAndPay(params.getMerchantCode(), params.getPaymentCode());
//				content.setList(list);
//			}
//		} else {
//			List<PaymentQuotaPO> list = paymentQuotaService.queryForList();
//			content.setList(list);
//		}
//
//		return new YYFaxRsp<PaymentQuotaQueryContent>(RspCodeEnum.SUCCESS, content);
//	}
//
// }
